﻿namespace OboutInc.ImageZoom
{
    using System;

    public abstract class AdapterBuilder
    {
        private object _source;

        protected AdapterBuilder()
        {
        }

        private void CheckForNull()
        {
            if (this._source == null)
            {
                throw new NullReferenceException("You must provide a valid source");
            }
        }

        public abstract IDataSourceAdapter Adapter { get; }

        public virtual object Source
        {
            get
            {
                this.CheckForNull();
                return this._source;
            }
            set
            {
                this._source = value;
                this.CheckForNull();
            }
        }
    }
}

